package com.litxuf;

public class DivPageUtil {

	public static void main(String[] args) {
		t(1);
		t(2);
		t(3);
		t(4);
		t(5);
		t(6);
		t(7);
		t(8);
		t(9);
		t(10);
		
	}
	
	public  static  void t(int curpage ) {
		String strHtml="";
		int pageCount=10;
		int page=curpage;
		int prevPage = page - 1, nextPage = page + 1;
		int  endPage=0;
		
		 
			strHtml += "<span class=current >页码: " +page + " / " + pageCount + "</span>";
			strHtml += "<span>";
			if (prevPage < 1) {
				 
			} else {
			 
				strHtml += "<a>上一页</a>";
			}
			 
			if (pageCount > page + 3) {
				    endPage = page + 3;
			} else {
				  endPage = pageCount;
			}
			for (int i = page - 3; i <= endPage; i++) {
				if (i > 0) {
					if (i == page) {
						strHtml += "<SPAN class=current>" + i + "</span>";
					} else {
					 
							strHtml += "<a>" + i + "</a>";
					 
					}
				}
			}
			 
			 
			if (nextPage > pageCount) {
				 
			 
			} else {
				strHtml += "<a>下一页</a>";
			 
			}
			strHtml += "</span><br />";
	 
		
		System.out.println(strHtml);
		
	}
}
